Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1874. Thanks to @dajiaohuang for the report.
The rule only treated
print/printlnas user-defined when the file had a top-level function with that name, so calls through a parameter, a local variable or a named result were reported as the built-in.The visitor now skips a callee identifier whose
Objis set, i.e. one the parser resolved to a declaration in scope; only an unresolved identifier can be the built-in. I kept the rule untyped (it is listed inuntyped.toml) and usedIdent.Objas other rules here already do, rather than requiring type information.testdata/use_fmt_print_with_local_shadowing.gocovers a parameter, a local variable and a named result (no failure) and real built-in calls (reported). It fails without the fix.A
print/printlnfunction declared at package level in another file of the package is still not detected; that would need type information.Replaces #1923, which got closed when my fork was accidentally detached.